Skip to content

Document #[diagnostic::on_move] in the unstable book.#155621

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
mejrs:document_diagnostic_on_move
Apr 24, 2026
Merged

Document #[diagnostic::on_move] in the unstable book.#155621
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
mejrs:document_diagnostic_on_move

Conversation

@mejrs
Copy link
Copy Markdown
Contributor

@mejrs mejrs commented Apr 21, 2026

Also adds the attribute on std::fs::File to stay consistent with the prose in the unstable book entry.

cc @estebank @rperier

Rendered:
image
image

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 21, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 21, 2026

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 72 candidates
  • Random selection from 17 candidates

@rust-log-analyzer

This comment has been minimized.

@rperier
Copy link
Copy Markdown
Contributor

rperier commented Apr 22, 2026

I would put the same kind of details in the diagnostic attribute of std::fs::File than on Rc and Arc (see 92ed4a2) : the idea being explain briefly why the user can use try_clone or clone , because it's cheap or designed for that purpose (or another reason). And then, you can then refer to File::try_clone from the notes. Because currently the compiler already talks about .clone() when the type implements the Clone trait, so just a supplementary note refering to File::try_clone is a bit confusing, imho. Providing more context to the user would be helpful.

+1 for the documentation, good idea ;)

@mejrs
Copy link
Copy Markdown
Contributor Author

mejrs commented Apr 22, 2026

File doesn't implement Clone, though, and we do not reference the File diagnostic item anywhere so there are no specialized diagnostics for it.

@mejrs mejrs force-pushed the document_diagnostic_on_move branch from 3504f9a to f010a15 Compare April 22, 2026 23:36
@rust-log-analyzer

This comment has been minimized.

@mejrs mejrs force-pushed the document_diagnostic_on_move branch from f010a15 to 9bf0c26 Compare April 23, 2026 10:19
}
```
The user may try to use it like this:
```rust
Copy link
Copy Markdown
Member

@chenyukang chenyukang Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe need to mark compile_fail

```rust,compile_fail,E0382

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, right. I'd forgotten this and to mark the error message as "text"...

@chenyukang
Copy link
Copy Markdown
Member

r=me after CI is green.

@rust-log-analyzer

This comment has been minimized.

@mejrs mejrs force-pushed the document_diagnostic_on_move branch from 9bf0c26 to ce880a4 Compare April 23, 2026 11:40
@mejrs
Copy link
Copy Markdown
Contributor Author

mejrs commented Apr 23, 2026

@bors r=chenyukang

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 23, 2026

📌 Commit ce880a4 has been approved by chenyukang

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 23, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 23, 2026
… r=chenyukang

Document #[diagnostic::on_move] in the unstable book.

Also adds the attribute on `std::fs::File` to stay consistent with the prose in the unstable book entry.

cc @estebank @rperier

Rendered:
<img width="791" height="903" alt="image" src="https://github.com/user-attachments/assets/a27a5211-7717-4f7f-a514-8316dccc78d5" />
<img width="779" height="390" alt="image" src="https://github.com/user-attachments/assets/a983108d-575e-4551-ab14-28611344e9b0" />
rust-bors Bot pushed a commit that referenced this pull request Apr 23, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #155621 (Document #[diagnostic::on_move] in the unstable book.)
 - #155671 (Simplify `Config::track_state`.)
 - #153482 (tests/ui/macros: add annotations for reference rules)
 - #155075 (Add docs about SDKs and C compilation on armv7a-vex-v5)
 - #155685 (Fix `get_child_at_index` return type hints)
 - #155686 (Fix array template arg lookup behavior)
 - #155690 (Fix classify_union to return Union for regular unions)
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 23, 2026
Document #[diagnostic::on_move] in the unstable book.

Also adds the attribute on `std::fs::File` to stay consistent with the prose in the unstable book entry.

cc @estebank @rperier 

Rendered:
<img width="791" height="903" alt="image" src="https://github.com/user-attachments/assets/a27a5211-7717-4f7f-a514-8316dccc78d5" />
<img width="779" height="390" alt="image" src="https://github.com/user-attachments/assets/a983108d-575e-4551-ab14-28611344e9b0" />
@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 23, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 23, 2026

💔 Test for 018e1e6 failed: CI. Failed job:

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

@bors retry
Spurious

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 24, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 24, 2026
… r=chenyukang

Document #[diagnostic::on_move] in the unstable book.

Also adds the attribute on `std::fs::File` to stay consistent with the prose in the unstable book entry.

cc @estebank @rperier

Rendered:
<img width="791" height="903" alt="image" src="https://github.com/user-attachments/assets/a27a5211-7717-4f7f-a514-8316dccc78d5" />
<img width="779" height="390" alt="image" src="https://github.com/user-attachments/assets/a983108d-575e-4551-ab14-28611344e9b0" />
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 24, 2026
… r=chenyukang

Document #[diagnostic::on_move] in the unstable book.

Also adds the attribute on `std::fs::File` to stay consistent with the prose in the unstable book entry.

cc @estebank @rperier

Rendered:
<img width="791" height="903" alt="image" src="https://github.com/user-attachments/assets/a27a5211-7717-4f7f-a514-8316dccc78d5" />
<img width="779" height="390" alt="image" src="https://github.com/user-attachments/assets/a983108d-575e-4551-ab14-28611344e9b0" />
rust-bors Bot pushed a commit that referenced this pull request Apr 24, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #149452 (Refactor out common code into a `IndexItem::new` constructor)
 - #155621 (Document #[diagnostic::on_move] in the unstable book.)
 - #155635 (delegation: rename `Self` generic param to `This` in recursive delegations)
 - #155730 (Some cleanups around per parent disambiguators)
 - #153537 (rustc_codegen_ssa: Define ELF flag value for sparc-unknown-linux-gnu)
 - #155219 (Do not suggest borrowing enclosing calls for nested where-clause obligations)
 - #155408 (rustdoc: Fix Managarm C Library name in cfg pretty printer)
 - #155571 (Enable AddressSanitizer on arm-unknown-linux-gnueabihf and armv7-unknown-linux-gnueabihf)
 - #155713 (test: Add a regression test for Apple platforms aborting on `free`)
 - #155723 (Fix tier level for 5 thumb bare-metal ARM targets)
 - #155735 (Fix typo by removing extra 'to')
 - #155736 (Remove `AllVariants` workaround for rust-analyzer)
rust-bors Bot pushed a commit that referenced this pull request Apr 24, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #149452 (Refactor out common code into a `IndexItem::new` constructor)
 - #155621 (Document #[diagnostic::on_move] in the unstable book.)
 - #155635 (delegation: rename `Self` generic param to `This` in recursive delegations)
 - #155730 (Some cleanups around per parent disambiguators)
 - #153537 (rustc_codegen_ssa: Define ELF flag value for sparc-unknown-linux-gnu)
 - #155219 (Do not suggest borrowing enclosing calls for nested where-clause obligations)
 - #155408 (rustdoc: Fix Managarm C Library name in cfg pretty printer)
 - #155571 (Enable AddressSanitizer on arm-unknown-linux-gnueabihf and armv7-unknown-linux-gnueabihf)
 - #155713 (test: Add a regression test for Apple platforms aborting on `free`)
 - #155723 (Fix tier level for 5 thumb bare-metal ARM targets)
 - #155735 (Fix typo by removing extra 'to')
 - #155736 (Remove `AllVariants` workaround for rust-analyzer)
@rust-bors rust-bors Bot merged commit e873839 into rust-lang:main Apr 24, 2026
11 of 12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 24, 2026
rust-timer added a commit that referenced this pull request Apr 24, 2026
Rollup merge of #155621 - mejrs:document_diagnostic_on_move, r=chenyukang

Document #[diagnostic::on_move] in the unstable book.

Also adds the attribute on `std::fs::File` to stay consistent with the prose in the unstable book entry.

cc @estebank @rperier

Rendered:
<img width="791" height="903" alt="image" src="https://github.com/user-attachments/assets/a27a5211-7717-4f7f-a514-8316dccc78d5" />
<img width="779" height="390" alt="image" src="https://github.com/user-attachments/assets/a983108d-575e-4551-ab14-28611344e9b0" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants